package com.ygu.user.service.handler;


 import com.ygu.user.WxMsgService;
 import com.ygu.user.service.adapter.TextBuilder;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;

import org.springframework.stereotype.Component;

 import javax.annotation.Resource;
 import java.util.Map;

/**
 * 扫码的处理器 当用户扫码之后 走的逻辑
 */
@Component
public class ScanHandler extends AbstractHandler {

    @Resource
    private WxMsgService wxMsgService;

    //用户扫码后 的回调
    @Override
    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map<String, Object> map,
                                    WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException {
        // 扫码事件处理
        logger.info("进行扫码事件！");
        //扫码之后需要用户进行信息授权操作 进行登入
        return wxMsgService.scan(wxMpXmlMessage, wxMpService);
    }

}
